package com.hice.demo.dubbo.user.service.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.hice.demo.dubbo.user.dao.UserDao;
import com.hice.demo.dubbo.user.model.User;
import com.hice.demo.dubbo.user.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * Created by hyson on 2017/3/13.
 */
@Component
@Service(version = "1.0.0")
public class UserServiceImpl implements UserService {
    @Autowired
    UserDao userDao;

    @Override
    public boolean add(User user) {
        return userDao.save(user) == null ? false : true;
    }

    @Override
    public boolean del(Long id) {
        boolean flag = true;
        try {
            userDao.delete(id);
        }catch (Exception e){
            flag = false;
        }
        return flag;
    }
}